package com.candy.control;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/changeRequest")
public class ChangeRequestScopeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        获取ServletContext对象,并向请求域中存储数据
//        新增
        req.setAttribute("sessionName","sessionvalue_old");
//      修改
        req.setAttribute("sessionName","sessionvalue_new");
//      移除
        req.removeAttribute("sessionName");
    }
}
